<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        // class Father {
        //     constructor(firstName, skill) {
        //         // console.log(firstName, skill);
        //         this.firstName = firstName
        //         this.skill = skill
        //     }

        //     money () {
        //         console.log('通过' + this.skill + '赚钱');
        //     }
        // }

        // class Son extends Father {
        //     constructor(x, y, z) {
        //         //super作为函数调用，调用父类的constructor
        //         super(x, y)
        //         //添加子类自己的属性
        //         this.z = z
        //         super.money()
        //     }

        //     exam () {
        //         console.log('考了71.1分');
        //     }
        // }

        // // const father = new Father('despot', '前端开发')
        // // console.log(father);
        // // father.money()
        // // father.exam()
        // const son = new Son('despot', '前端开发', '男')

        // // console.log(son);
        // // son.money()
        // // son.exam()

     
        class Father{
            constructor(uname,skill) {
                this.uname = uname
                this.skill = skill
            }
            money(){
                console.log('通过' + this.skill + '赚钱');
            }
        }


        class Son extends Father {
            constructor(uname,skill,habbit) {
                super(uname,skill)
                this.habbit = habbit
            }

            exam() {
                console.log('我考了100分');
            }
        }


        const ikun = new Son('young', '前端', '敲代码')
        const ikun1 = new Father('young', '前端', )

        console.log(ikun);
        console.log(ikun1);
        ikun1.money()
        ikun.exam()
        ikun.money()
    









    </script>
</body>

</html>